Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 3 - Endpoints / Endpoints Reference
Constants and Data Types


The TRequest Structure

You use the TRequest structure to specify the data being sent with the OTSndRequest function (page 3-137) and the data being read with the OTRcvRequest function (page 3-139). You pass a pointer to this structure as a parameter to each of these functions.

The TRequest structure is defined by the TRequest data type.

struct TRequest
   {
      TNetbuf     data;
      TNetbuf     opt;
      OTSequence  sequence;
   };
   typedef struct TRequest TRequest;
Field Description
data
A TNetbuf structure specifying the location and size of the request data buffer.
In the req parameter to the OTSndRequest function, this field specifies the location and size of a buffer containing the request. You must allocate a buffer for the request data, set the data.buf field to point to it, and set the data.len field to the size of the request data. The size of the request cannot exceed the value specified for the etsdu field of the TEndpointInfo structure for the endpoint.
If you are sending data that is not stored contiguously, the data.buf field is a pointer to an OTData structure that describes the first data fragment. In this case, you must set the udata.len field to kNetbufDataIsOTData.
In the req parameter to the OTRcvRequest function, on return, this field specifies the location and size of a buffer containing the incoming request. You must allocate a buffer into which the request data is placed when the function returns and set the data.buf field to point to it. You must set the data.maxlen field to the maximum size of the request data; this value cannot exceed the etsdu value specified for the endpoint. On return, the data.len field contains the actual length of the data sent.
If you are doing a no-copy receive, the data.buf field is a pointer to an OTBuffer pointer. In this case, you must set the data.maxlen field to the constant kNetbufDataIsOTBufferStar.
opt
A TNetbuf structure specifying the location and size of the options buffer.
In the req parameter to the OTSndRequest function, this field specifies the location and size of a buffer containing the options you want to negotiate for this request. You must allocate a buffer that contains the option data, set the opt.buf field to point to it, and set the opt.len field to the size of the option data. Set the opt.len field to 0 if there are no options.
In the req parameter to the OTRcvRequest function, on return, this field specifies the location and size of a buffer containing the association-related options specified by the requester. You must allocate a buffer into which the endpoint provider can place the option data when the function returns, and set the opt.buf field to point to it. Set the opt.maxlen field to the maximum size of this buffer.
sequence
A long that specifies the transaction ID of the current transaction.
You set this field to any desired value when you send
the request.
When you read the request, this value is generated by the endpoint provider. You need to save this value and use it for the sequence field when sending a reply.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996